<div class='top' onmousedown='sortable()' title='可以用鼠标拖拽来随意摆放哦'>
  <div class='title'>
    <%= link_to_tool_by_setting @setting %>
  </div>
  <div class='supports'>
    <%= link_to_remote image_tag(
           'base/funcs/sms.png', 
           :alt => '发送到我的手机', 
           :title => '发送到我的手机'
         ),
         :url => send_sm_tools_site_healths_url(:id => @setting.id) ,
         :method => :post,
         :loading => "$('sms_#{@setting.id}').innerHTML = '...'",
         :success => "alert('已经成功发送到您的手机上')",
         :failure => "alert(fetion_sm_state_name(request.responseText));", 
         :complete => "$('sms_#{@setting.id}').innerHTML = '#{image_tag(
           'base/funcs/sms.png', 
           :alt => '发送到我的手机', 
           :title => '发送到我的手机'
         )}'",
         :html => {
           :id => "sms_#{@setting.id}"
         } if @setting.allow_sms? 
    %>
    <%= link_to_remote image_tag(
           'base/funcs/email.png', 
           :alt => '发送到我的邮箱', 
           :title => '发送到我的邮箱'
         ),
         :url => send_email_tools_site_healths_url(:id => @setting.id) ,
         :method => :post,
         :loading => "$('email_#{@setting.id}').innerHTML = '...'",
         :success => "alert('已经成功发送到您的邮箱里')",
         :complete => "$('email_#{@setting.id}').innerHTML = '#{image_tag(
           'base/funcs/email.png', 
           :alt => '发送到我的邮箱', 
           :title => '发送到我的邮箱'
         )}'",
         :html => {
           :id => "email_#{@setting.id}"
         } if @setting.allow_email? 
    %>
  </div>
  <div class='tools'>
    <span id="portalet_<%= @setting.id %>_arrows" style='display:none;'>
      <%= link_to "←", "index", :class => :arrow %>
      <%= link_to "↑", "index", :class => :arrow %>
      <%= link_to "↓", "index", :class => :arrow %>
      <%= link_to "→", "index", :class => :arrow %>
    </span>
    <span class='h'>
      <%= link_to_remote "克隆", 
            :update => "' + $('portalet_#{@setting.id}').parentNode.id + '" ,
            :url => copy_tools_site_health_url(@setting),
            :method => :post,
            :html => {
              :class => :h 
            }            
        %>
      <%= link_to_remote "设置", 
            :update => "portalet_#{@setting.id}" ,
            :url => edit_tools_site_health_url(@setting),
            :method => :get,
            :html => {
              :class => :h 
            }            
        %>
      <%= link_to_remote "移除", 
            :confirm => '确认要扔掉这片吐司吗？',
            :url => tools_site_health_url(@setting),
            :method => :delete,
            :loading => "Effect.Fade('portalet_#{@setting.id}')",
            :html => {
              :class => :h 
            }            
        %>
    </span>
  </div>
</div>
<div id='tool_<%= @setting.id %>_content' class='content'>
  <div class='site_heart_beat'>    
    <dl>
      <dt>URL：</dt>
      <dd>
        <%= link_to @setting.site_url,           
              @setting.site_url, 
              :title => @setting.site_url,
              :target => :_blank %>      
      </dd>
    </dl>
    <dl>
      <dt>匹配内容：</dt>
      <dd><%= @setting.content_keyword %></dd>
    </dl>
    <dl>
      <dt>整点报告：</dt>
      <dd>每天<%= @setting.report_hour %>时</dd>
    </dl>
    <% if @setting.todays_site_heart_beat_daily_stat %>
    <dl class='b'>
      <dt>今日健康度：</dt>
      <dd><%= health_degree_with_color @setting.todays_site_heart_beat_daily_stat.health_degree %></dd>
      <dd><b class='a'><%= @setting.todays_site_heart_beat_daily_stat.available_site_heart_beats_count %>次</b>可用</dd>
      <dd><b class='una'><%= @setting.todays_site_heart_beat_daily_stat.unavailable_site_heart_beats_count %>次</b>故障</dd>
    </dl>
      <% if @setting.todays_site_heart_beat_daily_stat.the_slowest_heart_beat %>
      <dl class='b'>
        <dt>今日性能：</dt>
        <dd>平均<b><%= @setting.todays_site_heart_beat_daily_stat.avg_response_time %>ms</b></dd>
        <dd>最慢<b class='s'><%= @setting.todays_site_heart_beat_daily_stat.the_slowest_heart_beat.response_time %>ms</b></dd>
        <dd>最快<b class='f'><%= @setting.todays_site_heart_beat_daily_stat.the_fastest_heart_beat.response_time %>ms</b></dd>
      </dl>
      <% end %>
    <% end %>
  </div>
  <dl>
    <dd class="center">
      <%= link_to_remote "把把脉",
            :url => test_site_heart_beat_tools_site_healths_url,
            :method => :post,
            :with => "'&url=#{@setting.site_url}&content=#{@setting.content_keyword}'",
            :loading => "$('test_site_#{@setting.id}').innerHTML='把脉中...'",
            :failure => "alert(request.responseText);",
            :success => "alert(request.responseText);",
            :complete => "$('test_site_#{@setting.id}').innerHTML='把把脉'",
            :html => {
              :class => :other,
              :title => '看看网站是否可访问',
              :id => "test_site_#{@setting.id}"
            }
       %>
       <%= link_to "综合分析", stat_tools_site_healths_url(:id => @setting.id), :title => '更详细的综合分析' , :class => :search, :target => :_blank %>
    </dd>
  </dl>
</div>

  